/*
 * IndexController.java
 *
 * Created on January 7, 2008, 8:24 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package sqs.web;

/**
 *
 * @author Joko Yu
 */

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

public class IndexController implements Controller {
    
    /** Handles request */
    public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) 
        throws ServletException {
        
        if (request.isUserInRole("admin role")) 
            return new ModelAndView("admin");
        else if (request.isUserInRole("researcher role"))
            return new ModelAndView("researcher");
        else
            return new ModelAndView("respondent");
    }
   
}
